import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'

import Vant from 'vant'
import 'vant/lib/index.css'
import store from './store'

import FastClick from 'fastclick'

import i18n from './i18n/index'
import VueI18n from 'vue-i18n'
// import LangENUS from './i18n/en'
// import LangZHCN from './i18n/zh'

// 引入全局基础css
import './assets/css/base.css'

Vue.use(Vant)

// 解决移动端点击延迟200ms的问题
if ('addEventListener' in document) {
  document.addEventListener('DOMContentLoaded', function () {
    FastClick.attach(document.body)
  }, false)
}

// 导入axios
Vue.prototype.$http = axios
axios.defaults.baseURL = 'http://127.0.0.1:8787/api/v1'
Vue.config.productionTip = false

// 多语言
Vue.use(VueI18n, {
  i18n: (key, value) => i18n.t(key, value)
})

// 金钱过滤 ¥xx.xx
Vue.filter('moneyFormat', (value) => {
  return '¥' + Number(value).toFixed(2)
})

new Vue({
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount('#app')
